<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- 数据代理： 通过一个对象代理对另一个对象的属性进行操作 -->
  <script>
    let obj = {
      name: 'why',
      age: 18
    }
    let obj2 = {
      address: '北京'
    }
    Object.defineProperties(obj2, name, {
      get() {
        return obj.name
      },
      set(newValue) {
        obj.name = newValue
      }
    })

  </script>

</body>

</html>